import axios from 'axios'

async function login(user, identity) {
    const config = identity === 'student' ? { params: {
        userName: user.username,
        password: user.password,
        schoolName: user.schoolName
    }} : { params: {
        userName: user.username,
        password: user.password
    }}
    const resp = await axios.get(`/api/${identity}/login`,  config).catch((e) => {
        window.$message.error(e.response.data.message)
    })
    return resp.data
}

export default {
    login
}